<template>
  <div>
    <div>还有{{count}}条信息未完成</div>
    <input type="checkbox" :checked="getAll">
    <input type="text" v-model="text" @keydown.enter="addTodo({text});text='';">
  </div>
</template>

<script>
import {mapMutations,mapState,mapGetters} from "vuex"
  export default {
    name:"todoHeader",
    data(){
      return {
        text:""
      }
    },
    computed:{
      ...mapState(["todo"]),
      ...mapGetters(["count"]),
      getAll(){
        return this.todo.every(item=>item.isDone);
      }
    },
    methods:{
      ...mapMutations(["addTodo"]),
    }
  }
</script>

<style scoped>

</style>